const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('base_enterprise_info', {
    id: {
      autoIncrement: true,
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "唯一标识"
    },
    corpname: {
      type: DataTypes.STRING(200),
      allowNull: true,
      comment: "企业名称"
    },
    corpcode: {
      type: DataTypes.STRING(30),
      allowNull: false,
      primaryKey: true,
      comment: "组织机构代码"
    },
    licensenum: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "工商营业执照注册号"
    },
    areacode: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "行政区划"
    },
    address: {
      type: DataTypes.STRING(500),
      allowNull: true,
      comment: "企业营业地址"
    },
    postalcode: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "邮政编码"
    },
    legalman: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "法定代表人"
    },
    idcardtypenum: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "法定代表人身份证件类型代码"
    },
    legalmanidcard: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "法定代表人身份证件号码"
    },
    legalmanduty: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "法定代表人职务"
    },
    legalmanprotitle: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "法定代表人职称代码"
    },
    economicnum: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "企业经济类型代码"
    },
    regprin: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "注册资本"
    },
    factregprin: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "实收资本"
    },
    principalunitnum: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "注册资本币种代码"
    },
    corpbirthdate: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "成立日期"
    },
    officephone: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "办公电话"
    },
    fax: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "传真"
    },
    linkman: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "联系人姓名"
    },
    linktel: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "联系人电话"
    },
    linkphone: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "联系人移动电话"
    },
    email: {
      type: DataTypes.STRING(100),
      allowNull: true,
      comment: "联系邮箱"
    },
    url: {
      type: DataTypes.STRING(200),
      allowNull: true,
      comment: "企业网址"
    },
    description: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      comment: "备注"
    },
    isDeleted: {
      type: DataTypes.TINYINT,
      allowNull: true,
      comment: "是否删除",
      field: 'is_deleted'
    },
    createdUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'created_user'
    },
    createdTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "本系统创建时间",
      field: 'created_time'
    },
    updatedUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "修改人",
      field: 'updated_user'
    },
    updatedTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "修改时间",
      field: 'updated_time'
    }
  }, {
    sequelize,
    tableName: 'base_enterprise_info',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
          { name: "corpcode" },
        ]
      },
      {
        name: "corpcode",
        using: "BTREE",
        fields: [
          { name: "corpcode" },
        ]
      },
    ]
  });
};
